import request from '@/utils/request'

//  树形查找分类列表
export function queryCategoryTree () {
  return request({
    url: '/product/category/tree',
    method: 'get'
  })
}

//  获取指定id三层分类
export function threeCategoryTree (id) {
  return request({
    url: `/product/category/three/${id}`,
    method: 'get'
  })
}

//  通过指定id删除商品分类
export function deleteCategory (id) {
  return request({
    url: `/product/category/${id}`,
    method: 'delete'
  })
}

//  通过指定id删除商品分类
export function deleteBatchCategory (data) {
  return request({
    url: '/product/category/batch',
    method: 'delete',
    data
  })
}

//  根据商品类别id查询
export function queryByCategoryId (id) {
  return request({
    url: `/product/category/${id}`,
    method: 'get'
  })
}

//  添加商品分类表单对象
export function appendCategory (data) {
  return request({
    url: '/product/category',
    method: 'post',
    data
  })
}

//  修改商品分类表单对象
export function updateCategory (data) {
  return request({
    url: '/product/category',
    method: 'put',
    data
  })
}
